package dao;

import java.util.HashMap;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class PedometerDaoImpl implements PedometerDao {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public String selectMidByPhoneId(String phoneId) {
		return sqlSessionTemplate.selectOne("pedometer.selectMidByPhoneId",
				phoneId);
	}

	@Override
	public double selectAdditionalTemperature(String mid) {
		return sqlSessionTemplate.selectOne(
				"nfctag.selectAdditionalTemperature", mid);
	}

	@Override
	public void updateTemperature(HashMap<String, Object> temperatureMap) {
		sqlSessionTemplate.update("nfctag.updateTemperature", temperatureMap);
	}

	@Override
	public Double selectTemperature(String mid) {
		return sqlSessionTemplate.selectOne("nfctag.selectTemperature", mid);
	}

	@Override
	public void resetTemperature(String mid) {
		sqlSessionTemplate.update("nfctag.resetTemperature", mid);
	}

	@Override
	public void updateRedbean(String mid) {
		sqlSessionTemplate.update("nfctag.updateRedbean", mid);
	}

}
